﻿ USE [Many2Many]
GO
/****** Object:  Table [dbo].[DimProcess]    Script Date: 04/12/2009 18:39:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProcess]') AND type in (N'U'))
DROP TABLE [dbo].[DimProcess]
GO
/****** Object:  Table [dbo].[DimProcessGroup]    Script Date: 04/12/2009 18:39:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProcessGroup]') AND type in (N'U'))
DROP TABLE [dbo].[DimProcessGroup]
GO
/****** Object:  Table [dbo].[DimProduct]    Script Date: 04/12/2009 18:39:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProduct]') AND type in (N'U'))
DROP TABLE [dbo].[DimProduct]
GO
/****** Object:  Table [dbo].[FactOrderDetail]    Script Date: 04/12/2009 18:39:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FactOrderDetail]') AND type in (N'U'))
DROP TABLE [dbo].[FactOrderDetail]
GO
/****** Object:  Table [dbo].[FactOrderManufacturingProcess]    Script Date: 04/12/2009 18:39:09 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FactOrderManufacturingProcess]') AND type in (N'U'))
DROP TABLE [dbo].[FactOrderManufacturingProcess]
GO
/****** Object:  Table [dbo].[FactOrderManufacturingProcess]    Script Date: 04/12/2009 18:39:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FactOrderManufacturingProcess]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FactOrderManufacturingProcess](
	[OrderID] [nchar](10) NULL,
	[SubOrderID] [nchar](10) NULL,
	[ProcessID] [nchar](2) NULL
) ON [PRIMARY]
END
GO
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'A         ', N'A1        ', N'W1        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'A         ', N'A1        ', N'W2        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'A         ', N'A1        ', N'W9        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'A         ', N'A2        ', N'W1        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'A         ', N'A2        ', N'W9        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'B         ', N'B1        ', N'W1        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'B         ', N'B1        ', N'W9        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W1        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W2        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W3        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W4        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W5        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W6        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C1        ', N'W9        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C2        ', N'W1        ')
INSERT [dbo].[FactOrderManufacturingProcess] ([OrderID], [SubOrderID], [ProcessID]) VALUES (N'C         ', N'C2        ', N'W9        ')
/****** Object:  Table [dbo].[FactOrderDetail]    Script Date: 04/12/2009 18:39:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FactOrderDetail]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FactOrderDetail](
	[OrderID] [nchar](10) NULL,
	[SubOrderID] [nchar](10) NULL,
	[Product] [nchar](10) NULL,
	[Quantity] [int] NULL
) ON [PRIMARY]
END
GO
INSERT [dbo].[FactOrderDetail] ([OrderID], [SubOrderID], [Product], [Quantity]) VALUES (N'A         ', N'A1        ', N'P1        ', 1)
INSERT [dbo].[FactOrderDetail] ([OrderID], [SubOrderID], [Product], [Quantity]) VALUES (N'A         ', N'A2        ', N'P2        ', 1)
INSERT [dbo].[FactOrderDetail] ([OrderID], [SubOrderID], [Product], [Quantity]) VALUES (N'B         ', N'B1        ', N'P1        ', 1)
INSERT [dbo].[FactOrderDetail] ([OrderID], [SubOrderID], [Product], [Quantity]) VALUES (N'C         ', N'C1        ', N'P2        ', 1)
INSERT [dbo].[FactOrderDetail] ([OrderID], [SubOrderID], [Product], [Quantity]) VALUES (N'C         ', N'C2        ', N'P2        ', 1)
/****** Object:  Table [dbo].[DimProduct]    Script Date: 04/12/2009 18:39:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProduct]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DimProduct](
	[ProductID] [nchar](10) NULL,
	[ProductLabel] [nchar](10) NULL
) ON [PRIMARY]
END
GO
INSERT [dbo].[DimProduct] ([ProductID], [ProductLabel]) VALUES (N'P1        ', N'TV        ')
INSERT [dbo].[DimProduct] ([ProductID], [ProductLabel]) VALUES (N'P2        ', N'PC        ')
/****** Object:  Table [dbo].[DimProcessGroup]    Script Date: 04/12/2009 18:39:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProcessGroup]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DimProcessGroup](
	[ProcessGroupID] [nchar](10) NULL,
	[ProcessGroupLabel] [nchar](10) NULL
) ON [PRIMARY]
END
GO
INSERT [dbo].[DimProcessGroup] ([ProcessGroupID], [ProcessGroupLabel]) VALUES (N'PG1       ', N'BASIC     ')
INSERT [dbo].[DimProcessGroup] ([ProcessGroupID], [ProcessGroupLabel]) VALUES (N'PG2       ', N'Added     ')
INSERT [dbo].[DimProcessGroup] ([ProcessGroupID], [ProcessGroupLabel]) VALUES (N'PG3       ', N'Perso     ')
/****** Object:  Table [dbo].[DimProcess]    Script Date: 04/12/2009 18:39:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DimProcess]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DimProcess](
	[ProcessID] [nchar](2) NULL,
	[ProcessLabel] [nchar](10) NULL,
	[ProcessGroupID] [nchar](10) NULL
) ON [PRIMARY]
END
GO
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W1        ', N'Picking   ', N'PG1       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W2        ', N'Persona   ', N'PG3       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W3        ', N'Process V3', N'PG2       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W4        ', N'Pocess V4 ', N'PG2       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W5        ', N'Process V5', N'PG2       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W6        ', N'Branding  ', N'PG3       ')
INSERT [dbo].[DimProcess] ([ProcessID], [ProcessLabel], [ProcessGroupID]) VALUES (N'W9        ', N'Shipping  ', N'PG1       ')
